#include<bits/stdc++.h>

using namespace std;
char data[1000 + 100];
int top = -1;
char word[1000 + 100];

int main() {
    while (cin >> word) {
        top = -1;
        bool flag = true;
        for (int i = 0; i < strlen(word); i++) {
            if (word[i] == '(') {
                data[++top] = '(';
            } else if (word[i] == ')') {
                if (top == -1) {
                    flag = false;
                    break;
                }
                if (data[top] == '(') {
                    top--;

                }
            }
        }
        if (top == -1 && flag) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}